-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ctrl + [ support for exiting insert mode #536
base: master
Are you sure you want to change the base?
Conversation
bundles/vi/insert_map.moon
Outdated
@@ -33,6 +33,12 @@ insert_map = { | |||
state.change_mode editor, 'command' | |||
editor.cursor.column = math.max 1, editor.cursor.column - 1 | |||
|
|||
'ctrl_[': (editor) -> | |||
state.insert_edit = get_edit editor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please extract the code into a exit_insert_mode
function at the top next to get_edit
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've refactored the code per your request. Let me know if there's anything else I can do!
bundles/vi/insert_map.moon
Outdated
state.change_mode editor, 'command' | ||
editor.cursor.column = math.max 1, editor.cursor.column - 1 | ||
|
||
escape: (editor) -> exit_insert_mode editor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can just be written as
escape: exit_insert_mode
Same for next line.
Otherwise looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I've done so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found that the ctrl + [ doesn't work when writing python code at least, there's probably something overriding the key combo for that syntax, I'll investigate further at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still want to merge this then?
Added support for 'ctrl + [' to exit insert mode in the vi bundle.
Just duplicated the 'escape' portion of the insert_map.moon and swapped in the 'ctrl + ['